package com.hopu.oa.service.impl.UserManageControllerImpl;


import com.hopu.oa.dao.UserManage.deptManageDao;
import com.hopu.oa.entity.user.AoaDept;
import com.hopu.oa.entity.user.AoaPosition;
import com.hopu.oa.entity.user.AoaUser;
import com.hopu.oa.service.UserManageService.DeptManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DeptManageServiceImp implements DeptManageService {

    @Autowired
    deptManageDao deptManageDao;

    @Override
    public List<AoaDept> findAllDepts() {
        List<AoaDept> allDepts = deptManageDao.findAllDepts();
        return allDepts;
    }

    @Override
    public List<AoaDept> findAllDept(String deptName, int index, int size) {
        return deptManageDao.findAllDept(deptName, index, size);
    }

    @Override
    public AoaDept findDeptById(int id) {
        return deptManageDao.findDeptById(id);
    }

    @Override
    public AoaDept findDeptByDeptName(String deptName) {
        return deptManageDao.findDeptByDeptName(deptName);
    }

    @Override
    public int insertDept(String deptName, String deptTel, String deptFax, String email, String deptAddr, String startTime, String endTime) {
        return deptManageDao.insertDept(deptName, deptTel, deptFax, email, deptAddr, startTime, endTime);
    }

    @Override
    public int updateDept(String deptName, String deptTel, String deptFax, String email, String deptAddr, String endTime, int deptId) {
        return deptManageDao.updateDept(deptName, deptTel, deptFax, email, deptAddr, endTime, deptId);
    }


    @Override
    public List<AoaUser> findAllUserByDeptId(int deptId) {
        return deptManageDao.findAllUserByDeptId(deptId);
    }

    @Override
    public int deleteDept(int deptId) {
        return deptManageDao.deleteDept(deptId);
    }

    @Override
    public int findDeptByDeptNameId(String deptName) {
        return deptManageDao.findDeptByDeptNameId(deptName);
    }

    @Override
    public List<AoaDept> findDept() {
        return deptManageDao.findDept();
    }

    @Override
    public List<AoaDept> selectDepts() {
        return deptManageDao.selectDepts();
    }

    @Override
    public List<AoaUser> selectUserBydeptId(int deptid) {
        return deptManageDao.selectUserBydeptId(deptid);
    }

    @Override
    public AoaUser selectRelaName(int deptid) {
        return deptManageDao.selectRelaName(deptid);
    }

    @Override
    public AoaDept selectDeptById(int deptid) {
        return deptManageDao.selectDeptById(deptid);
    }

    @Override
    public List<AoaPosition> selectPositionById(int deptid) {
        return deptManageDao.selectPositionById(deptid);
    }

    @Override
    public List<AoaDept> selectdeptAll() {
        return deptManageDao.selectdeptAll();
    }

    @Override
    public int updatePositionById(int userid, int positionid, int deptid) {
        return deptManageDao.updatePositionById(userid, positionid, deptid);
    }

    @Override
    public int updateDeptmanager(int juserid, int deptid) {
        return deptManageDao.updateDeptmanager(juserid, deptid);
    }
}
